﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Text;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using OmronFinsTCP.Net;
namespace FinsDebuger
{
    public partial class Form_CIO : Form
    {
        private BackgroundWorker bgWorker = new BackgroundWorker();
        EtherNetPLC ENT_01;
        public string form1zhiip;
        public string form1zhiport;
        public bool connectFlag = false;
        private string form1Inputzhi = " ";
        private string form1Outputzhi = " ";
        public string machineCIStr1 = "";
        public string machineCOStr1 = "";

        short rd_HeartWord = 0;
        bool heartBit = false;
        bool outputForceBit = false;
        public Form_CIO()
        {
            InitializeComponent();
            InitializeBackgroundWorker();
        }
        private void InitializeBackgroundWorker()
        {
            bgWorker.WorkerReportsProgress = true;
            bgWorker.WorkerSupportsCancellation = true;
            bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork);
            bgWorker.ProgressChanged += new ProgressChangedEventHandler(bgWorker_ProgessChanged);
            bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_WorkerCompleted);
        }
        public void bgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            for (int i = 0; i >= 0; i++)
            {
                if (bgWorker.CancellationPending)
                {
                    e.Cancel = true;
                    return;
                }
                else
                {
                    bgWorker.ReportProgress(i, "Working");
                    System.Threading.Thread.Sleep(500);
                    form1Inputzhi = machineCIStr1;
                    form1Outputzhi = machineCOStr1;
                    readMachineInput();
                    readMachineOutput();
                    readMachineDM();

                    if (heartBit)
                    {
                        ENT_01.SetBitState(PlcMemory.WR, "0.11", BitState.ON); heartBit = false;
                    }
                    else
                    {
                        ENT_01.SetBitState(PlcMemory.WR, "0.11", BitState.OFF); heartBit = true;
                    }
                }
            }

        }
        public void bgWorker_ProgessChanged(object sender, ProgressChangedEventArgs e)
        {
            string strM;
            int i;
            char[] arr;
            string[] str = new string[10];
            string[] strButtonB = new string[10];
            strM = form1Inputzhi;
            i = strM.IndexOf(',');
            if (i >= 0)
            {
                for (int j = 0; j < 7; j++)
                {
                    str[j] = strM.Substring(0, i);
                    strM = strM.Substring(i + 1, strM.Length - i - 1);
                    i = strM.IndexOf(',');
                }
                for (int j = 0; j < 7; j++)
                {
                    strButtonB[j] = Convert.ToString(Convert.ToInt16(str[j]) + 32768, 2);
                }
                for (int j = 0; j < 7; j++)
                {
                    arr = strButtonB[j].ToCharArray();
                    Array.Reverse(arr);
                    strButtonB[j] = new string(arr);
                }
                for (int j = 0; j < 7; j++)
                {
                    for (int k = 0; k < 12; k++)
                    {
                        if (strButtonB[j][k] == '1')
                            lbInputArray[j * 16 + k].BackColor = Color.FromArgb(255, 0, 255, 0);
                        else
                            lbInputArray[j * 16 + k].BackColor = Color.FromArgb(255, 251, 189, 189);
                    }
                    strM = form1Outputzhi;
                    i = strM.IndexOf(',');
                }
            }
            strM = form1Outputzhi;
            i = strM.IndexOf(',');
            if (i >= 0)
            {
                for (int j = 0; j < 7; j++)
                {
                    str[j] = strM.Substring(0, i);
                    strM = strM.Substring(i + 1, strM.Length - i - 1);
                    i = strM.IndexOf(',');
                }
                for (int j = 0; j < 7; j++)
                {
                    strButtonB[j] = Convert.ToString(Convert.ToInt32(str[j]) + 32768, 2);//2020年8月3日为修复数据不够大BUG提示
                }
                for (int j = 0; j < 7; j++)
                {
                    arr = strButtonB[j].ToCharArray();
                    Array.Reverse(arr);
                    strButtonB[j] = new string(arr);
                }
                for (int j = 0; j < 7; j++)
                {
                    for (int k = 0; k < 12; k++)
                    {
                        if (strButtonB[j][k] == '1')
                            lbOutputArray[j * 16 + k].BackColor = Color.FromArgb(255, 0, 255, 0);
                        else
                            lbOutputArray[j * 16 + k].BackColor = Color.FromArgb(255, 251, 189, 189);
                    }
                }
            }

            label_HeartWord.Text = rd_HeartWord.ToString();
            if (rd_HeartWord % 2 == 1)
                label_HeartWord.BackColor = Color.FromArgb(255, 0, 255, 0);
            else
                label_HeartWord.BackColor = Color.FromArgb(255, 255, 0, 0);

        }
        public void bgWorker_WorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                MessageBox.Show(e.Error.ToString());
                return;
            }
            if (!e.Cancelled)
                this.label1.Text = "处理完毕!";
            else
                this.label1.Text = "处理终止!";

        }
        //public string Form1ChuanZhi
        //{
        //    get
        //    {
        //        return form1zhi;
        //    }
        //    set
        //    {
        //        form1zhi = value;
        //    }
        //}

        public string Form1ChuanIP
        {
            get
            {
                return form1zhiip;
            }
            set
            {
                form1zhiip = value;
            }
        }
        public string Form1ChuanPort
        {
            get
            {
                return form1zhiport;
            }
            set
            {
                form1zhiport = value;
            }
        }
        private void readMachineInput()
        {
            short[] rd;
            short re = ENT_01.ReadWords(PlcMemory.CIO, 0, 7, out rd);
            if (re != 0)
            {
                //写入数据出错
                //txtValues.Text = "数据读取出错！";
            }
            else
            {
                machineCIStr1 = "";
                //textBox_test02.Text = "";
                for (int i = 0; i < rd.Length; i++)
                {
                    //textBox_test02.Text += rd[i].ToString() + ",";
                    machineCIStr1 += rd[i].ToString() + ",";
                }
            }
        }
        private void readMachineOutput()
        {
            short[] rd;
            short re = ENT_01.ReadWords(PlcMemory.CIO, 100, 7, out rd);

            if (re != 0)
            {
                //写入数据出错
                //txtValues.Text = "数据读取出错！";
            }
            else
            {
                machineCOStr1 = "";
                //textBox_test02.Text = "";
                for (int i = 0; i < rd.Length; i++)
                {
                    //textBox_test02.Text += rd[i].ToString() + ",";
                    machineCOStr1 += rd[i].ToString() + ",";
                }
            }
        }
        private void readMachineDM()
        {
            short re = ENT_01.ReadWord(PlcMemory.DM, 2, out rd_HeartWord);
        }
        public bool plc01_connect(int con)
        {
            bool conOK = false;
            if (!connectFlag)
            {
                string plcip = form1zhiip;
                string plcport = form1zhiport;
                ENT_01 = new EtherNetPLC();
                short re = ENT_01.Link(plcip, short.Parse(plcport), 500);
                if (re == 0)
                {
                    connectFlag = true;
                    conOK = true;
                }
                else
                {
                    MessageBox.Show("连接出错！");
                }
            }
            else
            {
                conOK = true;
                //con用于判断是否点击断开按钮
                if (con == 1)
                {
                    bgWorker.CancelAsync();
                    short re = ENT_01.Close();
                    if (re == 0)
                    {
                        connectFlag = false;
                    }
                    else
                    {
                        MessageBox.Show("断开出错！");
                    }
                }
            }
            return conOK;
        }
        #region 预加载控件，防止出错
        Label[] lbInputArray = { new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label() };
        //Label[] lbOutputArray = { new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label(), new Label() };
        Button[] lbOutputArray = { new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button(), new Button() };
        #endregion
        private void lbOutputClick(object sender, EventArgs e)
        {
            Button lbl = (Button)(sender);
            string n = lbl.Name.Substring(14);
            int i;
            short bit2;
            if (button_EnOutQ.Text != "已启用")
            {
                i = 110 * 16 + Convert.ToInt32(n);
                ENT_01.GetBitState(PlcMemory.WR, (i / 16) + "." + (i % 16), out bit2);
                if (bit2 == 0)
                    ENT_01.SetBitState(PlcMemory.WR, (i / 16) + "." + (i % 16), BitState.ON);
                else
                    ENT_01.SetBitState(PlcMemory.WR, (i / 16) + "." + (i % 16), BitState.OFF);
            }
            else
            {
                i = 100 * 16 + Convert.ToInt32(n);
                ENT_01.GetBitState(PlcMemory.CIO, (i / 16) + "." + (i % 16), out bit2);
                if (bit2 == 0)
                    ENT_01.SetBitState(PlcMemory.CIO, (i / 16) + "." + (i % 16), BitState.ON);
                else
                    ENT_01.SetBitState(PlcMemory.CIO, (i / 16) + "." + (i % 16), BitState.OFF);

            }
        }
        private void Form_CIO_Load(object sender, EventArgs e)
        {
            //设置其他空间坐标，与IO点位适配，避免不同系统下显示于不同位置。
            label1.Location= new System.Drawing.Point(0 , 70);
            label3.Location = new System.Drawing.Point(0, 420);
            button_EnForcOut.Location = new System.Drawing.Point(150, 420);
            button_EnOutQ.Location = new System.Drawing.Point(255, 420);
            label_Tip1.Location= new System.Drawing.Point(463, 420);
            //设置输入点监控表
            for (int i = 0; i < lbInputArray.Length; i++)
            {
                lbInputArray[i].Location = new System.Drawing.Point(0 + (i / 16) * 200, 100 + (i % 16) * 20);
                lbInputArray[i].Name = "lbInputArray_" + i;
                lbInputArray[i].Text = " " + (i / 16) + "." + (i % 16);
                lbInputArray[i].Size = new System.Drawing.Size(200, 20);
                lbInputArray[i].TabIndex = i + 1;
                lbInputArray[i].TextAlign = ContentAlignment.MiddleLeft;
                if (i % 16 >= 12)
                {
                    lbInputArray[i].Visible = false;
                }
            }
            //设置输出点监控表
            for (int i = 0; i < lbOutputArray.Length; i++)
            {
                lbOutputArray[i].Location = new System.Drawing.Point(0 + (i / 16) * 200, 450 + (i % 16) * 20);
                lbOutputArray[i].Name = "lbOutputArray_" + i;
                lbOutputArray[i].Text = " " + (i / 16) + "." + (i % 16);
                lbOutputArray[i].Size = new System.Drawing.Size(200, 20);
                lbOutputArray[i].TabIndex = i + 1;
                lbOutputArray[i].Click += new EventHandler(lbOutputClick); //连接点击控件与事件
                lbOutputArray[i].TextAlign = ContentAlignment.MiddleLeft;
                lbOutputArray[i].FlatAppearance.BorderSize = 0;
                lbOutputArray[i].UseVisualStyleBackColor = false;
                if (i%16>=8)
                {
                    lbOutputArray[i].Visible = false;
                }
            }
            //控件在窗口显示。
            this.Controls.AddRange(lbInputArray);
            this.Controls.AddRange(lbOutputArray);
            if (plc01_connect(0))
            {
                if (bgWorker.IsBusy)
                    return;
                bgWorker.RunWorkerAsync("hello");
            }
            //判断PLC版本
            //if (connectFlag)
            {
                byte[] bytePLCVersion = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                short[] wordsPLCVersion = { 0, 0, 0, 0, 0 };

                ENT_01.ReadWords(PlcMemory.DM, 400, 5, out wordsPLCVersion);

                for (int i = 0; i < 5; i++)
                {
                    bytePLCVersion[i * 2] = Convert.ToByte(wordsPLCVersion[i] / 0x100);
                    bytePLCVersion[i * 2 + 1] = Convert.ToByte(wordsPLCVersion[i] % 0x100);
                }
                char[] charVersion = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
                string sVersion = ASCIIEncoding.ASCII.GetString(bytePLCVersion);
                if (sVersion[0] == 'E')
                    if (sVersion[1] == 'S')
                        if (sVersion[2] == 'S')
                            macType("ESS");
                if (sVersion[0] == 'H')
                    if (sVersion[1] == '4')
                        macType("H4");
            }
        }
        private void Form_CIO_FormClosed(object sender, FormClosedEventArgs e)
        {
            for (int i = 0; i < lbOutputArray.Length; i++)//解绑点击与事件防止多次绑定多次执行
            {
                lbOutputArray[i].Click -= new EventHandler(lbOutputClick);
            }
            //short re = ENT_01.Close();
            this.Close();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            form1Inputzhi = machineCIStr1;
            readMachineInput();
        }
        private void macType(String typeN)
        {
            if (typeN=="ESS"||typeN==null)
            {
                #region ESS IO表
                lbInputArray[0].Text = "0.00 A：库位急停按钮";
                lbInputArray[1].Text = "0.01 B：库位急停按钮";
                lbInputArray[2].Text = "0.02 C：库位急停按钮";
                lbInputArray[3].Text = "0.03 D：库位急停按钮";
                lbInputArray[4].Text = "0.04 A：库位门禁";
                lbInputArray[5].Text = "0.05 B：库位门禁";
                lbInputArray[6].Text = "0.06 C：库位门禁";
                lbInputArray[7].Text = "0.07 D：库位门禁";
                lbInputArray[8].Text = "0.08 治具拧紧伺服RDY";
                lbInputArray[9].Text = "0.09";
                lbInputArray[10].Text = "0.10 伺服ALM";
                lbInputArray[16].Text = "1.00";
                lbInputArray[17].Text = "1.01 气压检测";
                lbInputArray[18].Text = "1.02";
                lbInputArray[19].Text = "1.03";
                lbInputArray[20].Text = "1.04 A:托盘到位检测1";
                lbInputArray[21].Text = "1.05 A:托盘到位检测2";
                lbInputArray[22].Text = "1.06 B：托盘到位检测1";
                lbInputArray[23].Text = "1.07 B：托盘到位检测2";
                lbInputArray[24].Text = "1.08 C：托盘到位检测1";
                lbInputArray[25].Text = "1.09 C：托盘到位检测2";
                lbInputArray[26].Text = "1.10 D：托盘到位检测1";
                lbInputArray[27].Text = "1.11 D：托盘到位检测2";
                lbInputArray[32].Text = "2.00 A:料框来料到位检测1";
                lbInputArray[33].Text = "2.01 A:料框来料到位检测2";
                lbInputArray[34].Text = "2.02 A:气缸升到位";
                lbInputArray[35].Text = "2.03 A:气缸降到位";
                lbInputArray[36].Text = "2.04 A:托盘上升按钮";
                lbInputArray[37].Text = "2.05 A:托盘下降按钮";
                lbInputArray[38].Text = "2.06 A:烟雾检测1";
                lbInputArray[39].Text = "2.07 A:烟雾检测2";
                lbInputArray[40].Text = "2.08";
                lbInputArray[41].Text = "2.09 A：限高检测";
                lbInputArray[42].Text = "2.10 A：消防门下落检测";
                lbInputArray[43].Text = "2.11 A：消防门在位检测";
                lbInputArray[48].Text = "3.00 B:料框来料到位检测1";
                lbInputArray[49].Text = "3.01 B:料框来料到位检测2";
                lbInputArray[50].Text = "3.02 B:气缸升到位";
                lbInputArray[51].Text = "3.03 B:气缸降到位";
                lbInputArray[52].Text = "3.04 B:托盘上升按钮";
                lbInputArray[53].Text = "3.05 B：托盘下降按钮";
                lbInputArray[54].Text = "3.06 B:烟雾检测1";
                lbInputArray[55].Text = "3.07 B:烟雾检测2";
                lbInputArray[56].Text = "3.08";
                lbInputArray[57].Text = "3.09 B：限高检测";
                lbInputArray[58].Text = "3.10 B：消防门下落检测";
                lbInputArray[59].Text = "3.11 B：消防门在位检测";
                lbInputArray[64].Text = "4.00 C:料框来料到位检测1";
                lbInputArray[65].Text = "4.01 C:料框来料到位检测2";
                lbInputArray[66].Text = "4.02 C：测试升降气缸上升到位";
                lbInputArray[67].Text = "4.03 C：测试升降气缸下降到位";
                lbInputArray[68].Text = "4.04 C:托盘上升按钮";
                lbInputArray[69].Text = "4.05 C:托盘下降按钮";
                lbInputArray[70].Text = "4.06 C:烟雾检测1";
                lbInputArray[71].Text = "4.07 C:烟雾检测2";
                lbInputArray[72].Text = "4.08";
                lbInputArray[73].Text = "4.09 C：限高检测";
                lbInputArray[74].Text = "4.10 C：消防门下落检测";
                lbInputArray[75].Text = "4.11 C：消防门在位检测";
                lbInputArray[80].Text = "5.00 D:料框来料到位检测1";
                lbInputArray[81].Text = "5.01 D:料框来料到位检测2";
                lbInputArray[82].Text = "5.02 D：测试升降气缸上升到位";
                lbInputArray[83].Text = "5.03 D：测试升降气缸下降到位";
                lbInputArray[84].Text = "5.04 D：托盘上升按钮";
                lbInputArray[85].Text = "5.05 D：托盘下降按钮";
                lbInputArray[86].Text = "5.06 D:烟雾检测1";
                lbInputArray[87].Text = "5.07 D:烟雾检测2";
                lbInputArray[88].Text = "5.08";
                lbInputArray[89].Text = "5.09 D：限高检测";
                lbInputArray[90].Text = "5.10 D：消防门下落检测";
                lbInputArray[91].Text = "5.11 D：消防门在位检测";
                lbInputArray[96].Text = "6.00 A:库位使能";
                lbInputArray[97].Text = "6.01 B：库位使能";
                lbInputArray[98].Text = "6.02 C：库位使能";
                lbInputArray[99].Text = "6.03 D：库位使能";
                lbInputArray[100].Text = "6.04";
                lbInputArray[101].Text = "6.05";
                lbInputArray[102].Text = "6.06";
                lbInputArray[103].Text = "6.07";
                lbInputArray[104].Text = "6.08";
                lbInputArray[105].Text = "6.09";
                lbInputArray[106].Text = "6.10 加压正转按钮";
                lbInputArray[107].Text = "6.11 加压反转按钮";

                lbOutputArray[0].Text = "	100.0	治具拧紧伺服CW	";
                lbOutputArray[1].Text = "	100.1	治具拧紧伺服CCW	";
                lbOutputArray[2].Text = "	100.2	A:红色状态指示灯	";
                lbOutputArray[3].Text = "	100.3	A:绿色状态指示灯	";
                lbOutputArray[4].Text = "	100.4	B:红色状态指示灯	";
                lbOutputArray[5].Text = "	100.5	B:绿色状态指示灯	";
                lbOutputArray[6].Text = "	100.6	C:红色状态指示灯	";
                lbOutputArray[7].Text = "	100.7	C:绿色状态指示灯	";
                lbOutputArray[8].Text = "	100.8		";
                lbOutputArray[9].Text = "	100.9		";
                lbOutputArray[10].Text = "	100.10		";
                lbOutputArray[11].Text = "	100.11		";
                lbOutputArray[12].Text = "	100.12		";
                lbOutputArray[13].Text = "	100.13		";
                lbOutputArray[14].Text = "	100.14		";
                lbOutputArray[15].Text = "	100.15		";
                lbOutputArray[16].Text = "	101.0	治具拧紧伺服SON	";
                lbOutputArray[17].Text = "	101.1	治具拧紧伺服CLR	";
                lbOutputArray[18].Text = "	101.2	D:红色状态指示灯	";
                lbOutputArray[19].Text = "	101.3	D:绿色状态指示灯	";
                lbOutputArray[20].Text = "	101.4	A:库位使能按钮指示灯	";
                lbOutputArray[21].Text = "	101.5	B:库位使能按钮指示灯	";
                lbOutputArray[22].Text = "	101.6	C:库位使能按钮指示灯	";
                lbOutputArray[23].Text = "	101.7	D:库位使能按钮指示灯	";
                lbOutputArray[24].Text = "	101.8		";
                lbOutputArray[25].Text = "	101.9		";
                lbOutputArray[26].Text = "	101.10		";
                lbOutputArray[27].Text = "	101.11		";
                lbOutputArray[28].Text = "	101.12		";
                lbOutputArray[29].Text = "	101.13		";
                lbOutputArray[30].Text = "	101.14		";
                lbOutputArray[31].Text = "	101.15		";
                lbOutputArray[32].Text = "	102.0	A:测试料盒上升电磁阀	";
                lbOutputArray[33].Text = "	102.1	A:测试料盒下降电磁阀	";
                lbOutputArray[34].Text = "	102.2	A:托盘上升按钮指示	";
                lbOutputArray[35].Text = "	102.3	A:托盘下降按钮指示	";
                lbOutputArray[36].Text = "	102.4	B:测试料盒上升电磁阀	";
                lbOutputArray[37].Text = "	102.5	B:测试料盒下降电磁阀	";
                lbOutputArray[38].Text = "	102.6	B:托盘上升按钮指示	";
                lbOutputArray[39].Text = "	102.7	B:托盘下降按钮指示	";
                lbOutputArray[40].Text = "	102.8		";
                lbOutputArray[41].Text = "	102.9		";
                lbOutputArray[42].Text = "	102.10		";
                lbOutputArray[43].Text = "	102.11		";
                lbOutputArray[44].Text = "	102.12		";
                lbOutputArray[45].Text = "	102.13		";
                lbOutputArray[46].Text = "	102.14		";
                lbOutputArray[47].Text = "	102.15		";
                lbOutputArray[48].Text = "	103.0	C:测试料盒上升电磁阀	";
                lbOutputArray[49].Text = "	103.1	C:测试料盒下降电磁阀	";
                lbOutputArray[50].Text = "	103.2	C:托盘上升按钮指示	";
                lbOutputArray[51].Text = "	103.3	C:托盘下降按钮指示	";
                lbOutputArray[52].Text = "	103.4	D:测试料盒上升电磁阀	";
                lbOutputArray[53].Text = "	103.5	D:测试料盒下降电磁阀	";
                lbOutputArray[54].Text = "	103.6	D:托盘上升按钮指示	";
                lbOutputArray[55].Text = "	103.7	D:托盘下降按钮指示	";
                lbOutputArray[56].Text = "	103.8		";
                lbOutputArray[57].Text = "	103.9		";
                lbOutputArray[58].Text = "	103.10		";
                lbOutputArray[59].Text = "	103.11		";
                lbOutputArray[60].Text = "	103.12		";
                lbOutputArray[61].Text = "	103.13		";
                lbOutputArray[62].Text = "	103.14		";
                lbOutputArray[63].Text = "	103.15		";
                lbOutputArray[64].Text = "	104.0		";
                lbOutputArray[65].Text = "	104.1		";
                lbOutputArray[66].Text = "	104.2		";
                lbOutputArray[67].Text = "	104.3		";
                lbOutputArray[68].Text = "	104.4	层1风机中继	";
                lbOutputArray[69].Text = "	104.5	层2风机中继	";
                lbOutputArray[70].Text = "	104.6	拧紧OK绿色指示灯	";
                lbOutputArray[71].Text = "	104.7	拧紧NG红色指示灯	";
                lbOutputArray[72].Text = "	104.8		";
                lbOutputArray[73].Text = "	104.9		";
                lbOutputArray[74].Text = "	104.10		";
                lbOutputArray[75].Text = "	104.11		";
                lbOutputArray[76].Text = "	104.12		";
                lbOutputArray[77].Text = "	104.13		";
                lbOutputArray[78].Text = "	104.14		";
                lbOutputArray[79].Text = "	104.15		";
                lbOutputArray[80].Text = "	105.0	侧柜运行指示	";
                lbOutputArray[81].Text = "	105.1	侧柜故障指示	";
                lbOutputArray[82].Text = "	105.2	电控柜蜂鸣器	";
                lbOutputArray[83].Text = "	105.3	红灯	";
                lbOutputArray[84].Text = "	105.4	绿灯	";
                lbOutputArray[85].Text = "	105.5	黄灯	";
                lbOutputArray[86].Text = "	105.6	上层消防强制触发	";
                lbOutputArray[87].Text = "	105.7	下层消防强制触发	";
                lbOutputArray[88].Text = "	105.8		";
                lbOutputArray[89].Text = "	105.9		";
                lbOutputArray[90].Text = "	105.10		";
                lbOutputArray[91].Text = "	105.11		";
                lbOutputArray[92].Text = "	105.12		";
                lbOutputArray[93].Text = "	105.13		";
                lbOutputArray[94].Text = "	105.14		";
                lbOutputArray[95].Text = "	105.15		";
                lbOutputArray[96].Text = "	106.0	A：库位到料指示灯（左）	";
                lbOutputArray[97].Text = "	106.1	A：库位到料指示灯（右）	";
                lbOutputArray[98].Text = "	106.2	B：库位到料指示灯（左）	";
                lbOutputArray[99].Text = "	106.3	B：库位到料指示灯（右）	";
                lbOutputArray[100].Text = "	106.4	C：库位到料指示灯（左）	";
                lbOutputArray[101].Text = "	106.5	C：库位到料指示灯（右）	";
                lbOutputArray[102].Text = "	106.6	D：库位到料指示灯（左）	";
                lbOutputArray[103].Text = "	106.7	D：库位到料指示灯（右）	";
                lbOutputArray[104].Text = "	106.8		";
                lbOutputArray[105].Text = "	106.9		";
                lbOutputArray[106].Text = "	106.10		";
                lbOutputArray[107].Text = "	106.11		";
                lbOutputArray[108].Text = "	106.12		";
                lbOutputArray[109].Text = "	106.13		";
                lbOutputArray[110].Text = "	106.14		";
                lbOutputArray[111].Text = "	106.15		";
                lbOutputArray[112].Text = "	107.0		";
                lbOutputArray[113].Text = "	107.1		";
                lbOutputArray[114].Text = "	107.2		";
                lbOutputArray[115].Text = "	107.3		";
                lbOutputArray[116].Text = "	107.4		";
                lbOutputArray[117].Text = "	107.5		";
                lbOutputArray[118].Text = "	107.6		";
                lbOutputArray[119].Text = "	107.7		";
                lbOutputArray[120].Text = "	107.0		";
                lbOutputArray[121].Text = "	107.1		";
                lbOutputArray[122].Text = "	107.2		";
                lbOutputArray[123].Text = "	107.3		";
                lbOutputArray[124].Text = "	107.4		";
                lbOutputArray[125].Text = "	107.5		";
                lbOutputArray[126].Text = "	107.6		";
                lbOutputArray[127].Text = "	107.7		";
                lbOutputArray[128].Text = "	107.8		";
                lbOutputArray[129].Text = "	107.9		";
                lbOutputArray[130].Text = "	107.10		";
                lbOutputArray[131].Text = "	107.11		";
                lbOutputArray[132].Text = "	107.12		";
                lbOutputArray[133].Text = "	107.13		";
                lbOutputArray[134].Text = "	107.14		";
                lbOutputArray[135].Text = "	107.15		";
                #endregion

            }
            else if(typeN=="H4")
            {
                #region H4 IO表
                lbInputArray[0].Text = "	0.00	整机上电	";
                lbInputArray[1].Text = "	0.01	整机复位	";
                lbInputArray[2].Text = "	0.02	左门禁	";
                lbInputArray[3].Text = "	0.03	右门禁	";
                lbInputArray[4].Text = "	0.04	A库位左替罪羊检测	";
                lbInputArray[5].Text = "	0.05	A库位右替罪羊检测	";
                lbInputArray[6].Text = "	0.06	B库位左替罪羊检测	";
                lbInputArray[7].Text = "	0.07	B库位右替罪羊检测	";
                lbInputArray[8].Text = "	0.08	C库位左替罪羊检测	";
                lbInputArray[9].Text = "	0.09	C库位右替罪羊检测	";
                lbInputArray[10].Text = "	0.10	整机急停	";
                lbInputArray[11].Text = "	0.11		";
                lbInputArray[12].Text = "	0.12		";
                lbInputArray[13].Text = "	0.13		";
                lbInputArray[14].Text = "	0.14		";
                lbInputArray[15].Text = "	0.15		";
                lbInputArray[16].Text = "	1.00	进气检测	";
                lbInputArray[17].Text = "	1.01	A:手动/自动	";
                lbInputArray[18].Text = "	1.02	B:手动/自动	";
                lbInputArray[19].Text = "	1.03	C:手动/自动	";
                lbInputArray[20].Text = "	1.04		";
                lbInputArray[21].Text = "	1.05		";
                lbInputArray[22].Text = "	1.06		";
                lbInputArray[23].Text = "	1.07		";
                lbInputArray[24].Text = "	1.08		";
                lbInputArray[25].Text = "	1.09		";
                lbInputArray[26].Text = "	1.10		";
                lbInputArray[27].Text = "	1.11		";
                lbInputArray[28].Text = "	1.12		";
                lbInputArray[29].Text = "	1.13		";
                lbInputArray[30].Text = "	1.14		";
                lbInputArray[31].Text = "	1.15		";
                lbInputArray[32].Text = "	2.00	A:测试升降气缸上升到位	";
                lbInputArray[33].Text = "	2.01	A:测试升降气缸下降到位	";
                lbInputArray[34].Text = "	2.02	A:上升	";
                lbInputArray[35].Text = "	2.03	A:下降	";
                lbInputArray[36].Text = "	2.04	A:烟雾检测1	";
                lbInputArray[37].Text = "	2.05	A:烟雾检测2	";
                lbInputArray[38].Text = "	2.06	A:启动	";
                lbInputArray[39].Text = "	2.07	A:料框来料到位检测1	";
                lbInputArray[40].Text = "	2.08	A:料框来料到位检测2	";
                lbInputArray[41].Text = "	2.09	A:料框来料到位检测3	";
                lbInputArray[42].Text = "	2.10	A:料框来料到位检测4	";
                lbInputArray[43].Text = "	2.11		";
                lbInputArray[44].Text = "	2.12		";
                lbInputArray[45].Text = "	2.13		";
                lbInputArray[46].Text = "	2.14		";
                lbInputArray[47].Text = "	2.15		";
                lbInputArray[48].Text = "	3.00	B:测试升降气缸上升到位	";
                lbInputArray[49].Text = "	3.01	B:测试升降气缸下降到位	";
                lbInputArray[50].Text = "	3.02	B:上升	";
                lbInputArray[51].Text = "	3.03	B:下降	";
                lbInputArray[52].Text = "	3.04	B:烟雾检测1	";
                lbInputArray[53].Text = "	3.05	B:烟雾检测2	";
                lbInputArray[54].Text = "	3.06	B:启动	";
                lbInputArray[55].Text = "	3.07	B:料框来料到位检测1	";
                lbInputArray[56].Text = "	3.08	B:料框来料到位检测2	";
                lbInputArray[57].Text = "	3.09	B:料框来料到位检测3	";
                lbInputArray[58].Text = "	3.10	B:料框来料到位检测4	";
                lbInputArray[59].Text = "	3.11		";
                lbInputArray[60].Text = "	3.12		";
                lbInputArray[61].Text = "	3.13		";
                lbInputArray[62].Text = "	3.14		";
                lbInputArray[63].Text = "	3.15		";
                lbInputArray[64].Text = "	4.00	C:测试升降气缸上升到位	";
                lbInputArray[65].Text = "	4.01	C:测试升降气缸下降到位	";
                lbInputArray[66].Text = "	4.02	C:上升	";
                lbInputArray[67].Text = "	4.03	C:下降	";
                lbInputArray[68].Text = "	4.04	C:烟雾检测1	";
                lbInputArray[69].Text = "	4.05	C:烟雾检测2	";
                lbInputArray[70].Text = "	4.06	C:启动	";
                lbInputArray[71].Text = "	4.07	C:料框来料到位检测1	";
                lbInputArray[72].Text = "	4.08	C:料框来料到位检测2	";
                lbInputArray[73].Text = "	4.09	C:料框来料到位检测3	";
                lbInputArray[74].Text = "	4.10	C:料框来料到位检测4	";
                lbInputArray[75].Text = "	4.11		";
                lbInputArray[76].Text = "	4.12		";
                lbInputArray[77].Text = "	4.13		";
                lbInputArray[78].Text = "	4.14		";
                lbInputArray[79].Text = "	4.15		";
                lbInputArray[80].Text = "	5.00		";
                lbInputArray[81].Text = "	5.01		";
                lbInputArray[82].Text = "	5.02		";
                lbInputArray[83].Text = "	5.03		";
                lbInputArray[84].Text = "	5.04		";
                lbInputArray[85].Text = "	5.05		";
                lbInputArray[86].Text = "	5.06		";
                lbInputArray[87].Text = "	5.07		";
                lbInputArray[88].Text = "	5.08		";
                lbInputArray[89].Text = "	5.09		";
                lbInputArray[90].Text = "	5.10		";
                lbInputArray[91].Text = "	5.11		";
                lbInputArray[92].Text = "	5.12		";
                lbInputArray[93].Text = "	5.13		";
                lbInputArray[94].Text = "	5.14		";
                lbInputArray[95].Text = "	5.15		";
                lbInputArray[96].Text = "	6.00		";
                lbInputArray[97].Text = "	6.01		";
                lbInputArray[98].Text = "	6.02		";
                lbInputArray[99].Text = "	6.03		";
                lbInputArray[100].Text = "	6.04		";
                lbInputArray[101].Text = "	6.05		";
                lbInputArray[102].Text = "	6.06		";
                lbInputArray[103].Text = "	6.07		";
                lbInputArray[104].Text = "	6.08		";
                lbInputArray[105].Text = "	6.09		";
                lbInputArray[106].Text = "	6.10		";
                lbInputArray[107].Text = "	6.11		";
                lbInputArray[108].Text = "	6.12		";
                lbInputArray[109].Text = "	6.13		";
                lbInputArray[110].Text = "	6.14		";
                lbInputArray[111].Text = "	6.15		";
                lbInputArray[112].Text = "	7.00		";
                lbInputArray[113].Text = "	7.01		";
                lbInputArray[114].Text = "	7.02		";
                lbInputArray[115].Text = "	7.03		";
                lbInputArray[116].Text = "	7.04		";
                lbInputArray[117].Text = "	7.05		";
                lbInputArray[118].Text = "	7.06		";
                lbInputArray[119].Text = "	7.07		";
                lbInputArray[120].Text = "	7.08		";
                lbInputArray[121].Text = "	7.09		";
                lbInputArray[122].Text = "	7.10		";
                lbInputArray[123].Text = "	7.11		";
                lbInputArray[124].Text = "	7.12		";
                lbInputArray[125].Text = "	7.13		";
                lbInputArray[126].Text = "	7.14		";
                lbInputArray[127].Text = "	7.15		";

                lbOutputArray[0].Text = "	100.0	A:库位到料指示灯1	";
                lbOutputArray[1].Text = "	100.1	A:库位到料指示灯2	";
                lbOutputArray[2].Text = "	100.2	A:库位到料指示灯3	";
                lbOutputArray[3].Text = "	100.3	A:库位到料指示灯4	";
                lbOutputArray[4].Text = "	100.4	B:库位到料指示灯1	";
                lbOutputArray[5].Text = "	100.5	B:库位到料指示灯2	";
                lbOutputArray[6].Text = "	100.6	B:库位到料指示灯3	";
                lbOutputArray[7].Text = "	100.7	B:库位到料指示灯4	";
                lbOutputArray[8].Text = "	100.8		";
                lbOutputArray[9].Text = "	100.9		";
                lbOutputArray[10].Text = "	100.10		";
                lbOutputArray[11].Text = "	100.11		";
                lbOutputArray[12].Text = "	100.12		";
                lbOutputArray[13].Text = "	100.13		";
                lbOutputArray[14].Text = "	100.14		";
                lbOutputArray[15].Text = "	100.15		";
                lbOutputArray[16].Text = "	101.0	C:库位到料指示灯1	";
                lbOutputArray[17].Text = "	101.1	C:库位到料指示灯2	";
                lbOutputArray[18].Text = "	101.2	C:库位到料指示灯3	";
                lbOutputArray[19].Text = "	101.3	C:库位到料指示灯4	";
                lbOutputArray[20].Text = "	101.4	A:消防强制触发	";
                lbOutputArray[21].Text = "	101.5	B:消防强制触发	";
                lbOutputArray[22].Text = "	101.6	C:消防强制触发	";
                lbOutputArray[23].Text = "	101.7		";
                lbOutputArray[24].Text = "	101.8		";
                lbOutputArray[25].Text = "	101.9		";
                lbOutputArray[26].Text = "	101.10		";
                lbOutputArray[27].Text = "	101.11		";
                lbOutputArray[28].Text = "	101.12		";
                lbOutputArray[29].Text = "	101.13		";
                lbOutputArray[30].Text = "	101.14		";
                lbOutputArray[31].Text = "	101.15		";
                lbOutputArray[32].Text = "	102.0	A:测试料盒上升电磁阀	";
                lbOutputArray[33].Text = "	102.1	A:测试料盒下降电磁阀	";
                lbOutputArray[34].Text = "	102.2	A:上升指示灯	";
                lbOutputArray[35].Text = "	102.3	A:下降指示灯	";
                lbOutputArray[36].Text = "	102.4	启动指示灯	";
                lbOutputArray[37].Text = "	102.5	复位指示灯	";
                lbOutputArray[38].Text = "	102.6	A:启动指示灯	";
                lbOutputArray[39].Text = "	102.7	A:风机中继	";
                lbOutputArray[40].Text = "	102.8		";
                lbOutputArray[41].Text = "	102.9		";
                lbOutputArray[42].Text = "	102.10		";
                lbOutputArray[43].Text = "	102.11		";
                lbOutputArray[44].Text = "	102.12		";
                lbOutputArray[45].Text = "	102.13		";
                lbOutputArray[46].Text = "	102.14		";
                lbOutputArray[47].Text = "	102.15		";
                lbOutputArray[48].Text = "	103.0	B:测试料盒上升电磁阀	";
                lbOutputArray[49].Text = "	103.1	B:测试料盒下降电磁阀	";
                lbOutputArray[50].Text = "	103.2	B:上升指示灯	";
                lbOutputArray[51].Text = "	103.3	B:下降指示灯	";
                lbOutputArray[52].Text = "	103.4		";
                lbOutputArray[53].Text = "	103.5		";
                lbOutputArray[54].Text = "	103.6	B:启动指示灯	";
                lbOutputArray[55].Text = "	103.7	B:风机中继	";
                lbOutputArray[56].Text = "	103.8		";
                lbOutputArray[57].Text = "	103.9		";
                lbOutputArray[58].Text = "	103.10		";
                lbOutputArray[59].Text = "	103.11		";
                lbOutputArray[60].Text = "	103.12		";
                lbOutputArray[61].Text = "	103.13		";
                lbOutputArray[62].Text = "	103.14		";
                lbOutputArray[63].Text = "	103.15		";
                lbOutputArray[64].Text = "	104.0	C:测试料盒上升电磁阀	";
                lbOutputArray[65].Text = "	104.1	C:测试料盒下降电磁阀	";
                lbOutputArray[66].Text = "	104.2	C:上升指示灯	";
                lbOutputArray[67].Text = "	104.3	C:下降指示灯	";
                lbOutputArray[68].Text = "	104.4		";
                lbOutputArray[69].Text = "	104.5		";
                lbOutputArray[70].Text = "	104.6	C:启动指示灯	";
                lbOutputArray[71].Text = "	104.7	C:风机中继	";
                lbOutputArray[72].Text = "	104.8		";
                lbOutputArray[73].Text = "	104.9		";
                lbOutputArray[74].Text = "	104.10		";
                lbOutputArray[75].Text = "	104.11		";
                lbOutputArray[76].Text = "	104.12		";
                lbOutputArray[77].Text = "	104.13		";
                lbOutputArray[78].Text = "	104.14		";
                lbOutputArray[79].Text = "	104.15		";
                lbOutputArray[80].Text = "	105.0	侧柜运行指示	";
                lbOutputArray[81].Text = "	105.1	侧柜故障指示	";
                lbOutputArray[82].Text = "	105.2	蜂鸣器	";
                lbOutputArray[83].Text = "	105.3	红灯	";
                lbOutputArray[84].Text = "	105.4	绿灯	";
                lbOutputArray[85].Text = "	105.5	黄灯	";
                lbOutputArray[86].Text = "	105.6	校验工装供电中继	";
                lbOutputArray[87].Text = "	105.7		";
                lbOutputArray[88].Text = "	105.8		";
                lbOutputArray[89].Text = "	105.9		";
                lbOutputArray[90].Text = "	105.10		";
                lbOutputArray[91].Text = "	105.11		";
                lbOutputArray[92].Text = "	105.12		";
                lbOutputArray[93].Text = "	105.13		";
                lbOutputArray[94].Text = "	105.14		";
                lbOutputArray[95].Text = "	105.15		";
                lbOutputArray[96].Text = "	106.0		";
                lbOutputArray[97].Text = "	106.1		";
                lbOutputArray[98].Text = "	106.2		";
                lbOutputArray[99].Text = "	106.3		";
                lbOutputArray[100].Text = "	106.4		";
                lbOutputArray[101].Text = "	106.5		";
                lbOutputArray[102].Text = "	106.6		";
                lbOutputArray[103].Text = "	106.7		";
                lbOutputArray[104].Text = "	106.8		";
                lbOutputArray[105].Text = "	106.9		";
                lbOutputArray[106].Text = "	106.10		";
                lbOutputArray[107].Text = "	106.11		";
                lbOutputArray[108].Text = "	106.12		";
                lbOutputArray[109].Text = "	106.13		";
                lbOutputArray[110].Text = "	106.14		";
                lbOutputArray[111].Text = "	106.15		";
                lbOutputArray[112].Text = "	107.0		";
                lbOutputArray[113].Text = "	107.1		";
                lbOutputArray[114].Text = "	107.2		";
                lbOutputArray[115].Text = "	107.3		";
                lbOutputArray[116].Text = "	107.4		";
                lbOutputArray[117].Text = "	107.5		";
                lbOutputArray[118].Text = "	107.6		";
                lbOutputArray[119].Text = "	107.7		";
                lbOutputArray[120].Text = "	107.8		";
                lbOutputArray[121].Text = "	107.9		";
                lbOutputArray[122].Text = "	107.10		";
                lbOutputArray[123].Text = "	107.11		";
                lbOutputArray[124].Text = "	107.12		";
                lbOutputArray[125].Text = "	107.13		";
                lbOutputArray[126].Text = "	107.14		";
                lbOutputArray[127].Text = "	107.15		";
                #endregion
            }

        }
        private void button3_Click(object sender, EventArgs e)
        {
            macType("ESS");
            //machineType("ESS");
        }

        private void button4_Click(object sender, EventArgs e)
        {
            macType("H4");
        }
        private void button5_Click(object sender, EventArgs e)//启用强制输出功能
        {
            if (outputForceBit)
            {
                ENT_01.SetBitState(PlcMemory.WR, "0.10", BitState.OFF);
                label_Tip1.Text = " ";
                outputForceBit = false;
            }
            else
            {
                ENT_01.SetBitState(PlcMemory.WR, "0.10", BitState.ON);
                label_Tip1.Text = "单击下方对应点位可切换输出状态";
                outputForceBit = true;
            }
        }
        private void buttonEnOutQ_Click(object sender, EventArgs e)//启用直控Q点
        {
            if (button_EnOutQ.Text!= "已启用")
            {
                button_EnOutQ.Text = "已启用";
            }
            else
            {
                button_EnOutQ.Text = "启用直控Q点";
            }
        }
        private void button1_Click_1(object sender, EventArgs e)
        {
        }



    }
}
public class locationIOList
{
    public locationIOList()
    { }
    public string io
    {
        get { return io; }
        set { io = value; }
    }
    public string name
    {
        get { return name; }
        set { name = value; }
    }
    private string tips
    {
        get { return name; }
        set { name = value; }
    }
}
